﻿using Learun.Util;
using SqlSugar;
using System;
using System.Collections.Generic;
using System.Windows.Documents;

namespace Learun.Application.TwoDevelopment.ZZDT_EC

{
    /// <summary>
    /// 版 本 PIT-ADMS V7.0.3 敏捷开发框架
    /// Copyright (c) 2013-2018 Hexagon PPM
    /// 创 建：超级管理员
    /// 日 期：2022-06-21 15:32
    /// 描 述：接线模块 - panel柜子
    /// </summary>
    [SugarTable(TableName = "ec_Panel")]
    public class ec_PanelEntity
    {
        #region 实体成员
        /// <summary>
        /// ID
        /// </summary>
        /// <returns></returns>
        [SugarColumn(IsPrimaryKey = true)]
        public string PanelID { get; set; }
        /// <summary>
        /// 位置。默认给1
        /// </summary>
        /// <returns></returns>
        public string Panel_Loc_ID { get; set; } = "";
        /// <summary>
        /// 最大的端子排数目限制。默认为0，表示不限制。
        /// </summary>
        /// <returns></returns>
        public int MaxStripNumber { get; set; }

        /// <summary>
        /// <see cref="ec_enginedataEntity.EngineDataID"/>
        /// </summary>
        public string EngineerDataID { get; set; } = "";
        /// <summary>
        /// 创建人
        /// </summary>
        /// <returns></returns>
        public string CreateUserID { get; set; }
        /// <summary>
        /// 创建时间
        /// </summary>
        /// <returns></returns>
        public DateTime? CreateTime { get; set; }
        /// <summary>
        /// 更新人
        /// </summary>
        /// <returns></returns>
        public string UpdateUserID { get; set; }
        /// <summary>
        /// 更新时间
        /// </summary>
        /// <returns></returns>
        public DateTime? UpdateTime { get; set; }
        #endregion

        #region 扩展操作
        /// <summary>
        /// 新增调用
        /// </summary>
        public void Create()
        {
            this.Panel_Loc_ID = "1";
            this.PanelID = Guid.NewGuid().ToString();
            this.CreateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.CreateUserID = userInfo.userId;
        }
        /// <summary>
        /// 编辑调用
        /// </summary>
        /// <param name="keyValue"></param>
        public void Modify(string keyValue)
        {
            this.PanelID = keyValue;
            this.UpdateTime = Time.MySqlTime;
            UserInfo userInfo = LoginUserInfo.Get();
            this.UpdateUserID = userInfo.userId;
        }
        #endregion

        #region 扩展字段
        /// <summary>
        /// 从 ec engineerdata表拿
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string TagNumber { set; get; }

        /// <summary>
        /// 是否属于system柜
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string systempanel { set; get; }

        /// <summary>
        /// 类型
        /// </summary>
        [SugarColumn(IsIgnore = true)]
        public string ObjectTypeName { set; get; }

        [SugarColumn(IsIgnore = true)]
        public List<ec_PanelStripEntity> strips { set; get; }
        #endregion
    }
}

